package com.swpu.course_schedule.POJO.Course;

import java.util.List;

public class SingleWeekCourse {
    private int week;
    private int rid;
    private List<CourseArrange> courseArranges;
    /**
     * 返回课程信息
     * @param WEEK 周次
     * @param DAY 星期
     * @param SESSION 开始节次
     * @return 具体课程信息，如果无课则为空
     */
    public String getCourse(
            int WEEK,
            int DAY,
            int SESSION) {
        StringBuilder course = new StringBuilder();
        for (CourseArrange ca :
                courseArranges) {
            if (WEEK >= ca.getS_WEEK() && WEEK <= ca.getE_WEEK() &&
                    DAY == ca.getDAY() && SESSION == ca.getSESSION()){
                course.append(String.valueOf(ca.getC_ID()));
                course.append("\n");
                course.append(String.valueOf("专业"));
            }
        }
        return course.toString();
    }
    @Override
    public String toString() {
        return "SingleWeekCourse{" +
                "week=" + week +
                ", rid=" + rid +
                ", courseArranges=" + courseArranges +
                '}';
    }

    public SingleWeekCourse() {
    }

    public SingleWeekCourse(int week, int rid, List<CourseArrange> courseArranges) {
        this.week = week;
        this.rid = rid;
        this.courseArranges = courseArranges;
    }

    public int getWeek() {
        return week;
    }

    public void setWeek(int week) {
        this.week = week;
    }

    public int getRid() {
        return rid;
    }

    public void setRid(int rid) {
        this.rid = rid;
    }

    public List<CourseArrange> getCourseArranges() {
        return courseArranges;
    }

    public void setCourseArranges(List<CourseArrange> courseArranges) {
        this.courseArranges = courseArranges;
    }
}
